<?php
/**
 * Created by PhpStorm.
 * User: wudiying
 * Date: 2019/2/10
 * Time: 下午10:44
 */

namespace IMooc\Databases;


use IMooc\IDatabase;

class MySQL implements IDatabase
{
    protected $conn;

    function connect($host, $user, $password, $dbname)
    {
        $conn = mysql_connect($host, $user, $password);
        mysql_select_db($dbname);
        $this->conn = $conn;
    }

    function query($query)
    {
       $res =  mysql_query($query,$this->conn);
       return $res;
    }

    function close()
    {
        mysql_close($this->conn);
    }

}